<!DOCTYPE html>












  


<html class="theme-next mist use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">



  
  
  <link rel="stylesheet" href="/lib/needsharebutton/needsharebutton.css">










<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=6.6.0" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png?v=6.6.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png?v=6.6.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png?v=6.6.0">


  <link rel="mask-icon" href="/images/safari-logo.svg?v=6.6.0" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '6.6.0',
    sidebar: {"position":"left","width":300,"display":"post","offset":12,"b2t":false,"scrollpercent":true,"onmobile":true},
    fancybox: true,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="概述个人博客项目，使用Hexo静态博客框架创建，基于Next主题个性化定制，托管于代码托管平台的Pages服务上。 源码主要托管在 GitHub 远程仓库的source分支上；静态博客网页部署在 GitHub 远程仓库的master分支上，使用GitHub的Pages服务进行托管。 但是，受限于国内的网络环境原因，GitHub有时候会不能访问，或者网速实在“感人”。因此，需要同时将博客项目托管在国">
<meta name="keywords" content="Blog,Hexo,Next,备忘录">
<meta property="og:type" content="article">
<meta property="og:title" content="基于Hexo框架Next主题的个人博客（备忘录）">
<meta property="og:url" content="https://elinuxboy.github.io/Hexo/基于Hexo框架Next主题的个人博客（备忘录）.html">
<meta property="og:site_name" content="elinuxboy 的个人博客">
<meta property="og:description" content="概述个人博客项目，使用Hexo静态博客框架创建，基于Next主题个性化定制，托管于代码托管平台的Pages服务上。 源码主要托管在 GitHub 远程仓库的source分支上；静态博客网页部署在 GitHub 远程仓库的master分支上，使用GitHub的Pages服务进行托管。 但是，受限于国内的网络环境原因，GitHub有时候会不能访问，或者网速实在“感人”。因此，需要同时将博客项目托管在国">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2019-01-05T00:04:05.757Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="基于Hexo框架Next主题的个人博客（备忘录）">
<meta name="twitter:description" content="概述个人博客项目，使用Hexo静态博客框架创建，基于Next主题个性化定制，托管于代码托管平台的Pages服务上。 源码主要托管在 GitHub 远程仓库的source分支上；静态博客网页部署在 GitHub 远程仓库的master分支上，使用GitHub的Pages服务进行托管。 但是，受限于国内的网络环境原因，GitHub有时候会不能访问，或者网速实在“感人”。因此，需要同时将博客项目托管在国">






  <link rel="canonical" href="https://elinuxboy.github.io/Hexo/基于Hexo框架Next主题的个人博客（备忘录）.html">



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>基于Hexo框架Next主题的个人博客（备忘录） | elinuxboy 的个人博客</title>
  











  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">elinuxboy 的个人博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <h1 class="site-subtitle" itemprop="description">为者常成，行者常至!<br> Just Do It！</h1>
      
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">

    
    
    
      
    

    
      
    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-about">

    
    
    
      
    

    
      
    

    <a href="/about/" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">

    
    
    
      
    

    
      
    

    <a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签<span class="badge">17</span></a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">

    
    
    
      
    

    
      
    

    <a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类<span class="badge">7</span></a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">

    
    
    
      
    

    
      
    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档<span class="badge">7</span></a>

  </li>

      
      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>搜索</a>
        </li>
      
    </ul>
  

  
    

  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



  



</div>
    </header>

    
  
  
  
  

  

    <a href="https://github.com/elinuxboy" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewbox="0 0 250 250" style="fill: #222; color: #fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"/><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"/><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"/></svg></a>



    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://elinuxboy.github.io/Hexo/基于Hexo框架Next主题的个人博客（备忘录）.html">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="elinuxoby">
      <meta itemprop="description" content="elinuxboy 的个人博客">
      <meta itemprop="image" content="/images/head.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="elinuxboy 的个人博客">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">基于Hexo框架Next主题的个人博客（备忘录）
              
            
          </h2>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-12-31 23:17:25" itemprop="dateCreated datePublished" datetime="2018-12-31T23:17:25+08:00">2018-12-31</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2019-01-05 08:04:05" itemprop="dateModified" datetime="2019-01-05T08:04:05+08:00">2019-01-05</time>
              
            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing"><a href="/categories/Blog/" itemprop="url" rel="index"><span itemprop="name">Blog</span></a></span>

                
                
                  ，
                
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing"><a href="/categories/Blog/Hexo/" itemprop="url" rel="index"><span itemprop="name">Hexo</span></a></span>

                
                
                  ，
                
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing"><a href="/categories/Blog/Hexo/Next/" itemprop="url" rel="index"><span itemprop="name">Next</span></a></span>

                
                
              
            </span>
          

          
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="post-meta-item-icon">
            <i class="fa fa-eye"></i>
             阅读次数： 
            <span class="busuanzi-value" id="busuanzi_value_page_pv"></span>
            </span>
          

          
            <div class="post-symbolscount">
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                  <span class="post-meta-item-text">本文字数：</span>
                
                <span title="本文字数">6.5k</span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                
                <span title="阅读时长">6 分钟</span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="概述"><a href="#概述" class="headerlink" title="概述"></a>概述</h1><p>个人博客项目，使用<code>Hexo</code>静态博客框架创建，基于<code>Next</code>主题个性化定制，托管于代码托管平台的<code>Pages</code>服务上。</p>
<p>源码主要托管在 <a href="https://github.com" target="_blank" rel="noopener">GitHub</a> 远程仓库的<code>source</code>分支上；静态博客网页部署在 <a href="https://github.com" target="_blank" rel="noopener">GitHub</a> 远程仓库的<code>master</code>分支上，使用<code>GitHub</code>的<code>Pages</code>服务进行托管。</p>
<p>但是，受限于国内的网络环境原因，<code>GitHub</code>有时候会不能访问，或者网速实在“感人”。因此，需要同时将博客项目托管在国内的其他代码托管平台。</p>
<p>目前正在使用的代码托管平台为：<a href="https://gitee.com" target="_blank" rel="noopener">Gitee</a>（<a href="https://www.oschina.net/" target="_blank" rel="noopener">开源中国 oschina</a>推出的基于<code>Git</code>的代码托管平台，个人有<code>5G</code>的免费私有仓库）和 <a href="https://coding.net/" target="_blank" rel="noopener">Coding</a>（现在使用的是<a href="https://dev.tencent.com" target="_blank" rel="noopener">腾讯云</a>），同时，静态博客网页使用各自的<code>Pages</code>托管服务进行托管。</p>
<p>以下是我的个人博客项目在各个代码托管平台上远程仓库的项目地址和博客访问地址：</p>
<ul>
<li><code>GitHub</code>远程仓库</li>
</ul>
<p>项目地址：<a href="https://github.com/elinuxboy/elinuxboy.github.io" target="_blank" rel="noopener">https://github.com/elinuxboy/elinuxboy.github.io</a></p>
<p>博客访问地址：<a href="https://elinuxboy.github.io">https://elinuxboy.github.io</a></p>
<ul>
<li><code>Gitee</code>远程仓库</li>
</ul>
<p>项目地址：<a href="https://gitee.com/elinuxboy/elinuxboy" target="_blank" rel="noopener">https://gitee.com/elinuxboy/elinuxboy</a></p>
<p>博客访问地址：<a href="https://elinuxboy.gitee.io" target="_blank" rel="noopener">https://elinuxboy.gitee.io</a></p>
<ul>
<li><code>Coding</code>远程仓库</li>
</ul>
<p>项目地址：<a href="https://dev.tencent.com/u/elinuxboy/p/elinuxboy.coding.me/git" target="_blank" rel="noopener">https://dev.tencent.com/u/elinuxboy/p/elinuxboy.coding.me/git</a></p>
<p>博客访问地址：<a href="https://elinuxboy.coding.me" target="_blank" rel="noopener">https://elinuxboy.coding.me</a></p>
<h1 id="前提准备"><a href="#前提准备" class="headerlink" title="前提准备"></a>前提准备</h1><p>要使用<code>Hexo</code>创建博客项目，必须检查电脑中是否已安装下列应用程序：</p>
<ul>
<li><a href="http://nodejs.org/" target="_blank" rel="noopener">Node.js</a></li>
<li><a href="http://git-scm.com/" target="_blank" rel="noopener">Git</a></li>
<li><a href="http://lmgtfy.com/?q=linux+curl+tar+wget+install" target="_blank" rel="noopener">curl、tar 和 wget</a> </li>
<li><a href="https://www.npmjs.com/" target="_blank" rel="noopener">npm</a>（国内使用 <a href="https://npm.taobao.org/" target="_blank" rel="noopener">cnpm</a>，即<a href="https://npm.taobao.org/" target="_blank" rel="noopener">淘宝 npm</a> 代替）</li>
<li><a href="https://hexo.io/zh-cn/" target="_blank" rel="noopener">Hexo</a></li>
</ul>
<p>具体如何安装可以百度，或者参考：<a href="https://hexo.io/zh-cn/docs/" target="_blank" rel="noopener">Hexo | 文档</a>。</p>
<h1 id="项目管理"><a href="#项目管理" class="headerlink" title="项目管理"></a>项目管理</h1><p>为了更好的进行管理和使用博客项目，需要使用<code>git</code>等工具对博客项目进行版本控制，并且将其托管在托管平台的远程仓库上。</p>
<h2 id="已有项目"><a href="#已有项目" class="headerlink" title="已有项目"></a>已有项目</h2><p>对于已经托管在代码托管平台上的博客项目，或者在更换了不同电脑的情况下，只需要将项目克隆下来即可继续使用。</p>
<h3 id="克隆项目"><a href="#克隆项目" class="headerlink" title="克隆项目"></a>克隆项目</h3><p>以<code>GitHub</code>远程仓库为例，需要克隆<code>source</code>源码分支。</p>
<p><code>git clone -b source git@github.com:elinuxboy/elinuxboy.github.io.git</code></p>
<h3 id="安装依赖模块"><a href="#安装依赖模块" class="headerlink" title="安装依赖模块"></a>安装依赖模块</h3><p>对于重新克隆下来的博客项目，想要使用，需要重新安装依赖：</p>
<p><code>cnpm install</code></p>
<p>这一步将会根据<code>package.json</code>文件安装所需要的模块。</p>
<h2 id="新项目"><a href="#新项目" class="headerlink" title="新项目"></a>新项目</h2><p>对于需要重新创建项目时，可以按照如下方式进行。</p>
<h3 id="新建-Hexo-博客项目"><a href="#新建-Hexo-博客项目" class="headerlink" title="新建 Hexo 博客项目"></a>新建 Hexo 博客项目</h3><p>在工作空间创建并初始化<code>Hexo</code>博客项目，<code>Hexo</code> 将会新建所需要的文件：</p>
<p><code>hexo init hexoBlog</code></p>
<div><div class="fold_hider"><div class="close hider_title">点击显示/隐藏内容</div></div><div class="fold">
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line">$ hexo init hexoBlog</span><br><span class="line">INFO  Cloning hexo-starter to ~/workspace/blog/hexo/hexoBlog</span><br><span class="line">正克隆到 <span class="string">'/home/elinuxboy/workspace/blog/hexo/hexoBlog'</span>...</span><br><span class="line">remote: Enumerating objects: 68, <span class="keyword">done</span>.</span><br><span class="line">remote: Total 68 (delta 0), reused 0 (delta 0), pack-reused 68</span><br><span class="line">展开对象中: 100% (68/68), 完成.</span><br><span class="line">子模组 <span class="string">'themes/landscape'</span>（https://github.com/hexojs/hexo-theme-landscape.git）未对路径 <span class="string">'themes/landscape'</span> 注册</span><br><span class="line">正克隆到 <span class="string">'/home/elinuxboy/workspace/blog/hexo/hexoBlog/themes/landscape'</span>...</span><br><span class="line">remote: Enumerating objects: 1, <span class="keyword">done</span>.        </span><br><span class="line">remote: Counting objects: 100% (1/1), <span class="keyword">done</span>.        </span><br><span class="line">remote: Total 867 (delta 0), reused 0 (delta 0), pack-reused 866        </span><br><span class="line">接收对象中: 100% (867/867), 2.55 MiB | 775.00 KiB/s, 完成.</span><br><span class="line">处理 delta 中: 100% (459/459), 完成.</span><br><span class="line">子模组路径 <span class="string">'themes/landscape'</span>：检出 <span class="string">'73a23c51f8487cfcd7c6deec96ccc7543960d350'</span></span><br><span class="line">INFO  Install dependencies</span><br><span class="line">npm WARN deprecated titlecase@1.1.2: no longer maintained</span><br><span class="line">npm WARN deprecated postinstall-build@5.0.3: postinstall-build<span class="string">'s behavior is now built into npm! You should migrate off of postinstall-build and use the new `prepare` lifecycle script with npm 5.0.0 or greater.</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">&gt; nunjucks@3.1.6 postinstall /home/elinuxboy/workspace/blog/hexo/hexoBlog/node_modules/nunjucks</span></span><br><span class="line"><span class="string">&gt; node postinstall-build.js src</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">npm notice created a lockfile as package-lock.json. You should commit this file.</span></span><br><span class="line"><span class="string">npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):</span></span><br><span class="line"><span class="string">npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted &#123;"os":"darwin","arch":"any"&#125; (current: &#123;"os":"linux","arch":"x64"&#125;)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">added 422 packages from 501 contributors and audited 4700 packages in 19.96s</span></span><br><span class="line"><span class="string">found 0 vulnerabilities</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">INFO  Start blogging with Hexo!</span></span><br></pre></td></tr></table></figure>

</div></div>
<p>进入 <strong>hexo 根</strong>目录。这一目录中应当有 <code>node_modules</code>、<code>source</code>、<code>themes</code> 等若干子目录和文件：</p>
<p><code>cd hexoBlog</code></p>
<div><div class="fold_hider"><div class="close hider_title">点击显示/隐藏内容</div></div><div class="fold">
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">.</span><br><span class="line">├── _config.yml* <span class="comment"># 站点配置文件</span></span><br><span class="line">├── package.json* <span class="comment"># 已安装模块信息文件</span></span><br><span class="line">├── package-lock.json*</span><br><span class="line">├── .gitignore <span class="comment"># 版本控制忽略控制文件 </span></span><br><span class="line">├── node_modules/ <span class="comment"># 已安装`nodejs`模块文件夹</span></span><br><span class="line">├── scaffolds/ <span class="comment"># 模板文件夹</span></span><br><span class="line">│   ├── draft.md* <span class="comment"># 草稿模板文件</span></span><br><span class="line">│   ├── page.md* <span class="comment"># 页面模板文件</span></span><br><span class="line">│   └── post.md* <span class="comment"># 发布文章模板文件</span></span><br><span class="line">├── <span class="built_in">source</span>/ <span class="comment"># 资源文件夹</span></span><br><span class="line">│   └── _posts/ <span class="comment"># 发布文章文件夹</span></span><br><span class="line">└── themes/ <span class="comment"># 主题文件夹</span></span><br><span class="line">    └── landscape/ <span class="comment"># landscape 主题文件夹</span></span><br></pre></td></tr></table></figure>

</div></div>
<h3 id="本地版本控制仓库"><a href="#本地版本控制仓库" class="headerlink" title="本地版本控制仓库"></a>本地版本控制仓库</h3><h4 id="初始化"><a href="#初始化" class="headerlink" title="初始化"></a>初始化</h4><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ git init</span><br><span class="line">已初始化空的 Git 仓库于 /home/elinuxboy/workspace/blog/hexo/hexoBlog/.git/</span><br></pre></td></tr></table></figure>
<p>查看<code>git</code>本地版本控制仓库状态：</p>
<p><code>git status</code></p>
<div><div class="fold_hider"><div class="close hider_title">点击显示/隐藏内容</div></div><div class="fold">
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">$ git status      </span><br><span class="line">位于分支 master</span><br><span class="line"></span><br><span class="line">尚无提交</span><br><span class="line"></span><br><span class="line">未跟踪的文件:</span><br><span class="line">  （使用 <span class="string">"git add &lt;文件&gt;..."</span> 以包含要提交的内容）</span><br><span class="line"></span><br><span class="line">	.gitignore</span><br><span class="line">	_config.yml</span><br><span class="line">	package-lock.json</span><br><span class="line">	package.json</span><br><span class="line">	scaffolds/</span><br><span class="line">	<span class="built_in">source</span>/</span><br><span class="line">	themes/</span><br><span class="line"></span><br><span class="line">提交为空，但是存在尚未跟踪的文件（使用 <span class="string">"git add"</span> 建立跟踪）</span><br></pre></td></tr></table></figure>

</div></div>
<h4 id="git-ignore-设置"><a href="#git-ignore-设置" class="headerlink" title="git ignore 设置"></a>git ignore 设置</h4><figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">$ cat .gitignore </span><br><span class="line">.DS_Store</span><br><span class="line">Thumbs.db</span><br><span class="line">db.json</span><br><span class="line">*.<span class="built_in">log</span></span><br><span class="line">node_modules/</span><br><span class="line">public/</span><br><span class="line">.deploy*/</span><br></pre></td></tr></table></figure>
<h4 id="创建源码分支"><a href="#创建源码分支" class="headerlink" title="创建源码分支"></a>创建源码分支</h4><p>创建新分支<code>source</code>用于管理<code>Hexo</code>博客源码，并切换到<code>source</code>分支：</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ git checkout -b <span class="built_in">source</span></span><br><span class="line">切换到一个新分支 <span class="string">'source</span></span><br></pre></td></tr></table></figure>
<h4 id="添加内容到暂存区"><a href="#添加内容到暂存区" class="headerlink" title="添加内容到暂存区"></a>添加内容到暂存区</h4><p><code>git add .</code></p>
<h4 id="提交暂存区的内容"><a href="#提交暂存区的内容" class="headerlink" title="提交暂存区的内容"></a>提交暂存区的内容</h4><p><code>git commit -a</code></p>
<p>添加提交日志：</p>
<div><div class="fold_hider"><div class="close hider_title">点击显示/隐藏内容</div></div><div class="fold">
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">初始提交</span><br><span class="line"></span><br><span class="line">新创建 Hexo 博客并初始化</span><br><span class="line"></span><br><span class="line">初始化本地版本控制仓库</span><br><span class="line"></span><br><span class="line">增加新分支 source 用于管理 Hexo 博客项目源码</span><br></pre></td></tr></table></figure>

</div></div>
<h3 id="远程版本控制仓库"><a href="#远程版本控制仓库" class="headerlink" title="远程版本控制仓库"></a>远程版本控制仓库</h3><p>想要将博客项目托管在代码托管平台上，需要在代码托管平台上创建远程版本控制仓库并和本地版本控制仓库进行关联，然后推送本地版本控制仓库到远程仓库。</p>
<h4 id="创建远程仓库"><a href="#创建远程仓库" class="headerlink" title="创建远程仓库"></a>创建远程仓库</h4><ul>
<li><p>GitHub</p>
<p>创建名为<code>elinuxboy.github.io</code>空仓库。</p>
</li>
<li><p>Gitee</p>
<p>创建名为<code>elinuxboy</code>的空仓库。</p>
</li>
<li><p>Coding</p>
<p>创建名为<code>elinuxboy.coding.me</code>的空仓库。</p>
</li>
</ul>
<h4 id="添加远程仓库关联"><a href="#添加远程仓库关联" class="headerlink" title="添加远程仓库关联"></a>添加远程仓库关联</h4><p>以<code>Github</code>代码托管平台为例，使用<code>Github</code>的远程仓库作为默认远程仓库，其他代码托管品台的远程仓库作为备用，需要按照如下方式添加远程仓库关联：</p>
<p><code>git remote add origin git@github.com:elinuxboy/elinuxboy.github.io.git</code></p>
<p>再将其他托管平台的远程仓库作为<code>push</code>方式添加：</p>
<p><code>git remote set-url --add origin git@gitee.com:elinuxboy/elinuxboy.git</code></p>
<p><code>git remote set-url --add origin git@git.dev.tencent.com:elinuxboy/elinuxboy.coding.me.git</code></p>
<p>添加远程仓库关联完成后，可查看是否正确添加：</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">origin	git@github.com:elinuxboy/elinuxboy.github.io.git (fetch)</span><br><span class="line">origin	git@github.com:elinuxboy/elinuxboy.github.io.git (push)</span><br><span class="line">origin	git@gitee.com:elinuxboy/elinuxboy.git (push)</span><br><span class="line">origin	git@git.dev.tencent.com:elinuxboy/elinuxboy.coding.me.git (push)</span><br></pre></td></tr></table></figure>
<p>如果使用其他托管平台作为默认远程仓库，方法与上面相同，只需要替换相应的地址即可。</p>
<h4 id="推送源码到远程仓库"><a href="#推送源码到远程仓库" class="headerlink" title="推送源码到远程仓库"></a>推送源码到远程仓库</h4><p>上面已经将博客项目源码提交到本地版本控制仓库了，要将代码托管在托管平台，需要将本地版本控制仓库推送到代码托管平台的远程仓库。</p>
<p>查看当前所在的分支：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">$</span><span class="bash"> git status </span></span><br><span class="line">位于分支 source</span><br><span class="line">您的分支与上游分支 'origin/source' 一致。</span><br></pre></td></tr></table></figure>
<p>将本地版本控制仓库的<code>source</code>分支推送到远程仓库的<code>source</code>分支：</p>
<p><code>git push origin source</code></p>
<h1 id="使用-Next-主题"><a href="#使用-Next-主题" class="headerlink" title="使用 Next 主题"></a>使用 Next 主题</h1><h2 id="下载最新-release-版本"><a href="#下载最新-release-版本" class="headerlink" title="下载最新 release 版本"></a>下载最新 release 版本</h2><p>选择好相应的 <a href="https://github.com/theme-next/hexo-theme-next/releases/latest" target="_blank" rel="noopener">release 版本</a>。使用 <a href="http://lmgtfy.com/?q=linux+curl+tar+wget+install" target="_blank" rel="noopener">curl、tar 和 wget</a> 安装(此处已加上版本号，使用时需要手动<strong>替换版本号</strong>)：</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ mkdir themes/next-v6.6.0</span><br><span class="line">$ curl -s https://api.github.com/repos/theme-next/hexo-theme-next/releases/latest | grep tarball_url | cut -d <span class="string">'"'</span> -f 4 | wget -i - -O- | tar -zx -C themes/next-v6.6.0 --strip-components=1</span><br></pre></td></tr></table></figure>
<h2 id="启用-Next-主题"><a href="#启用-Next-主题" class="headerlink" title="启用 Next 主题"></a>启用 Next 主题</h2><p>修改站点配置文件<code>/_config.yml</code>，启用<code>Next</code>主题：</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Extensions</span></span><br><span class="line"><span class="comment">## Plugins: https://hexo.io/plugins/</span></span><br><span class="line"><span class="comment">## Themes: https://hexo.io/themes/</span></span><br><span class="line"><span class="comment"># theme: landscape</span></span><br><span class="line"><span class="attr">theme:</span> <span class="string">next-v6.6.0</span> <span class="comment"># 启用 Next 主题</span></span><br></pre></td></tr></table></figure>
<p>启用了<code>Next</code>主题后，就可以对<code>Next</code>主题进行相应的优化和个性化定制了。</p>
<h1 id="以-Hexo-方式使用-Hexo-数据文件特性"><a href="#以-Hexo-方式使用-Hexo-数据文件特性" class="headerlink" title="以 Hexo 方式使用 Hexo 数据文件特性"></a>以 Hexo 方式使用 Hexo 数据文件特性</h1><p>将全部配置都将置于<code>hexo</code>站点配置文件<code>/_config.yml</code>中，将主题配置文件的所有项复制到站点配置文件中进行修改，不需要修改主题配置文件<code>/themes/next-xxx/_config.yml</code>，或者创建其他的配置文件。但是所有的主题选项必须放置在 <code>theme_config:</code> 后，并全部增加两个空格的缩进。</p>
<p>如果在新的 release 中出现了任何新的选项，那么你只需要从 <code>next/_config.yml</code> 中将他们复制到 <code>hexo/_config.yml</code> 中并设置它们的值为你想要的选项。</p>
<h1 id="远程部署"><a href="#远程部署" class="headerlink" title="远程部署"></a>远程部署</h1><p>上面已经将博客项目的源码推送到代码托管平台的远程版本控制仓库了，下面就是将博客静态网页相关文件部署到代码托管平台的远程仓库上了。</p>
<h2 id="部署设置"><a href="#部署设置" class="headerlink" title="部署设置"></a>部署设置</h2><p>为了将博客静态站点部署到不同的代码托管平台，需要按照如下方式在配置文件内（站点配置文件）设置部署信息：</p>
<div><div class="fold_hider"><div class="close hider_title">点击显示/隐藏内容</div></div><div class="fold">
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Deployment 远程部署设置</span></span><br><span class="line"><span class="comment">## Docs: https://hexo.io/docs/deployment.html</span></span><br><span class="line"><span class="attr">deploy:</span></span><br><span class="line">  <span class="comment"># github</span></span><br><span class="line"><span class="attr">- type:</span> <span class="string">git</span></span><br><span class="line"><span class="attr">  repo:</span> <span class="string">git@github.com:elinuxboy/elinuxboy.github.io.git,</span></span><br><span class="line"><span class="attr">  branch:</span> <span class="string">master</span> <span class="comment"># 部署到主分支</span></span><br><span class="line">  <span class="comment"># coding</span></span><br><span class="line"><span class="attr">- type:</span> <span class="string">git</span></span><br><span class="line"><span class="attr">  repo:</span> <span class="string">git@git.dev.tencent.com:elinuxboy/elinuxboy.coding.me.git</span></span><br><span class="line"><span class="attr">  branch:</span> <span class="string">master</span> <span class="comment"># 部署到主分支</span></span><br><span class="line">  <span class="comment"># gitee</span></span><br><span class="line"><span class="attr">- type:</span> <span class="string">git</span></span><br><span class="line"><span class="attr">  repo:</span> <span class="string">git@gitee.com:elinuxboy/elinuxboy.git</span></span><br><span class="line"><span class="attr">  branch:</span> <span class="string">master</span> <span class="comment"># 部署到主分支</span></span><br></pre></td></tr></table></figure>

</div></div>
<h2 id="安装部署插件"><a href="#安装部署插件" class="headerlink" title="安装部署插件"></a>安装部署插件</h2><p>修改了部署设置信息，想要使用<code>hexo</code>进行部署，还需要安装部署插件：</p>
<p><code>cnpm install hexo-deployer-git --save</code></p>
<h2 id="部署"><a href="#部署" class="headerlink" title="部署"></a>部署</h2><p>根据<code>Hexo</code>文档说明，使用以下命令进行部署(先清空后生成再部署)：</p>
<p><code>hexo clean &amp;&amp; hexo g -d</code></p>

      
    </div>

    
      

  <div class="popular-posts-header">相关文章</div>
  <ul class="popular-posts">
  
    <li class="popular-posts-item">
      
      
      <div class="popular-posts-title"><a href="/hello-world.html" rel="bookmark">Hello World</a></div>
      
    </li>
  
    <li class="popular-posts-item">
      
      
      <div class="popular-posts-title"><a href="/Hexo/基于Hexo框架Next主题的个人博客（文章内音乐播放和视频播放）.html" rel="bookmark">基于Hexo框架Next主题的个人博客（文章内音乐播放和视频播放）</a></div>
      
    </li>
  
  </ul>


    

    
    
    

    

    
      
    
    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>文章不错哟，快快打赏吧！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/images/wechatpay.jpg" alt="elinuxoby 微信支付">
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/alipay.jpg" alt="elinuxoby 支付宝">
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    
      <div>
        



  



<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>elinuxoby</li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    
    <a href="https://elinuxboy.github.io/Hexo/基于Hexo框架Next主题的个人博客（备忘录）.html" title="基于Hexo框架Next主题的个人博客（备忘录）">https://elinuxboy.github.io/Hexo/基于Hexo框架Next主题的个人博客（备忘录）.html</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="noopener" target="_blank"><i class="fa fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！</li>
</ul>

      </div>
    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Blog/" rel="tag"><i class="fa fa-tag"></i> Blog</a>
          
            <a href="/tags/Hexo/" rel="tag"><i class="fa fa-tag"></i> Hexo</a>
          
            <a href="/tags/Next/" rel="tag"><i class="fa fa-tag"></i> Next</a>
          
            <a href="/tags/备忘录/" rel="tag"><i class="fa fa-tag"></i> 备忘录</a>
          
        </div>
      

      
      
        <div class="post-widgets">
        

        

        
          
          <div class="social_share">
            
            
               <div id="needsharebutton-postbottom">
                 <span class="btn">
                    <i class="fa fa-share-alt" aria-hidden="true"></i>
                 </span>
               </div>
            
          </div>
        
        </div>
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/Hexo/基于Hexo框架Next主题的个人博客（文章内音乐播放和视频播放）.html" rel="next" title="基于Hexo框架Next主题的个人博客（文章内音乐播放和视频播放）">
                <i class="fa fa-chevron-left"></i> 基于Hexo框架Next主题的个人博客（文章内音乐播放和视频播放）
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/hello-world.html" rel="prev" title="Hello World">
                Hello World <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  
    <div class="comments" id="comments">
      <div id="lv-container" data-id="city" data-uid="MTAyMC80MTkzMC8xODQ3Ng=="></div>
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
      <div id="sidebar-dimmer"></div>
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/images/head.jpg" alt="elinuxoby">
            
              <p class="site-author-name" itemprop="name">elinuxoby</p>
              <p class="site-description motion-element" itemprop="description">elinuxboy 的个人博客</p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">7</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  <a href="/categories/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">7</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">17</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  
                  
                  
                    
                  
                  <a href="https://github.com/elinuxboy" title="GitHub &rarr; https://github.com/elinuxboy" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i></a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                  
                    
                  
                  <a href="mailto:elinuxboy001@gmail.com" title="E-Mail &rarr; mailto:elinuxboy001@gmail.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i></a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                  
                    
                  
                  <a href="https://weibo.com/p/1005056887217453" title="Weibo &rarr; https://weibo.com/p/1005056887217453" rel="noopener" target="_blank"><i class="fa fa-fw fa-weibo"></i></a>
                </span>
              
            </div>
          

          
             <div class="cc-license motion-element" itemprop="license">
              
                
              
              
              
              <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" rel="noopener" target="_blank"><img src="/images/cc-by-nc-sa.svg" alt="Creative Commons"></a>
             </div>
          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-inline">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-link"></i>
                友情链接
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.cnblogs.com/elinuxboy" title="https://www.cnblogs.com/elinuxboy" rel="noopener" target="_blank">博客园</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://gitee.com/elinuxboy" title="https://gitee.com/elinuxboy" rel="noopener" target="_blank">Gitee</a>
                  </li>
                
              </ul>
            </div>
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#概述"><span class="nav-number">1.</span> <span class="nav-text">概述</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#前提准备"><span class="nav-number">2.</span> <span class="nav-text">前提准备</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#项目管理"><span class="nav-number">3.</span> <span class="nav-text">项目管理</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#已有项目"><span class="nav-number">3.1.</span> <span class="nav-text">已有项目</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#克隆项目"><span class="nav-number">3.1.1.</span> <span class="nav-text">克隆项目</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装依赖模块"><span class="nav-number">3.1.2.</span> <span class="nav-text">安装依赖模块</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#新项目"><span class="nav-number">3.2.</span> <span class="nav-text">新项目</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#新建-Hexo-博客项目"><span class="nav-number">3.2.1.</span> <span class="nav-text">新建 Hexo 博客项目</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#本地版本控制仓库"><span class="nav-number">3.2.2.</span> <span class="nav-text">本地版本控制仓库</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#初始化"><span class="nav-number">3.2.2.1.</span> <span class="nav-text">初始化</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#git-ignore-设置"><span class="nav-number">3.2.2.2.</span> <span class="nav-text">git ignore 设置</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#创建源码分支"><span class="nav-number">3.2.2.3.</span> <span class="nav-text">创建源码分支</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#添加内容到暂存区"><span class="nav-number">3.2.2.4.</span> <span class="nav-text">添加内容到暂存区</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#提交暂存区的内容"><span class="nav-number">3.2.2.5.</span> <span class="nav-text">提交暂存区的内容</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#远程版本控制仓库"><span class="nav-number">3.2.3.</span> <span class="nav-text">远程版本控制仓库</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#创建远程仓库"><span class="nav-number">3.2.3.1.</span> <span class="nav-text">创建远程仓库</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#添加远程仓库关联"><span class="nav-number">3.2.3.2.</span> <span class="nav-text">添加远程仓库关联</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#推送源码到远程仓库"><span class="nav-number">3.2.3.3.</span> <span class="nav-text">推送源码到远程仓库</span></a></li></ol></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#使用-Next-主题"><span class="nav-number">4.</span> <span class="nav-text">使用 Next 主题</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#下载最新-release-版本"><span class="nav-number">4.1.</span> <span class="nav-text">下载最新 release 版本</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#启用-Next-主题"><span class="nav-number">4.2.</span> <span class="nav-text">启用 Next 主题</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#以-Hexo-方式使用-Hexo-数据文件特性"><span class="nav-number">5.</span> <span class="nav-text">以 Hexo 方式使用 Hexo 数据文件特性</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#远程部署"><span class="nav-number">6.</span> <span class="nav-text">远程部署</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#部署设置"><span class="nav-number">6.1.</span> <span class="nav-text">部署设置</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#安装部署插件"><span class="nav-number">6.2.</span> <span class="nav-text">安装部署插件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#部署"><span class="nav-number">6.3.</span> <span class="nav-text">部署</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2018 – <span itemprop="copyrightYear">2019</span>
  <span class="with-love" id="animate">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">elinuxboy 版权所有</span>

  
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
    
      <span class="post-meta-item-text">站点总字数：</span>
    
    <span title="站点总字数">65k</span>
  

  
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    
      <span class="post-meta-item-text">站点阅读时长 &asymp;</span>
    
    <span title="站点阅读时长">59 分钟</span>
  
</div>


  <div class="powered-by">由 <a href="https://hexo.io" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v3.8.0</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 – <a href="https://theme-next.org" class="theme-link" rel="noopener" target="_blank">NexT.Mist</a> v6.6.0</div>





<span class="post-meta-divider"> | </span>

<span><i class="fa fa-plug"></i></span>
<span id="showDays"></span>
<script>
  var seconds = 1000;
  var minutes = seconds * 60;
  var hours = minutes * 60;
  var days = hours * 24;
  var years = days * 365;
  var birthDay = Date.UTC(2018,12,31,23,59,59); // 这里设置建站时间
  setInterval(function() {
    var today = new Date();
    var todayYear = today.getFullYear();
    var todayMonth = today.getMonth()+1;
    var todayDate = today.getDate();
    var todayHour = today.getHours();
    var todayMinute = today.getMinutes();
    var todaySecond = today.getSeconds();
    var now = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
    var diff = now - birthDay;
    var diffYears = Math.floor(diff/years);
    var diffDays = Math.floor((diff/days)-diffYears*365);
    var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
    var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
    var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
      document.getElementById('showDays').innerHTML="本站已运行 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒";
  }, 1000);
</script>
        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv" title="总访客量">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  

  
    <span class="site-pv" title="总访问量">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>









        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
          <span id="scrollpercent"><span>0</span>%</span>
        
      </div>
    

    

    

    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>












  















  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.6.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.6.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.6.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.6.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.6.0"></script>



  



  
    <script type="text/javascript">
      window.livereOptions = {
        refer: 'Hexo/基于Hexo框架Next主题的个人博客（备忘录）.html'
      };
      (function(d, s) {
        var j, e = d.getElementsByTagName(s)[0];
        if (typeof LivereTower === 'function') { return; }
        j = d.createElement(s);
        j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
        j.async = true;
        e.parentNode.insertBefore(j, e);
      })(document, 'script');
    </script>
  










  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  

  

  
  
  
  <script src="/lib/needsharebutton/needsharebutton.js"></script>

  <script>
    
      pbOptions = {};
      
          pbOptions.iconStyle = "box";
      
          pbOptions.boxForm = "horizontal";
      
          pbOptions.position = "bottomCenter";
      
          pbOptions.networks = "Weibo,Wechat,Douban,QQZone,Twitter,Facebook";
      
      new needShareButton('#needsharebutton-postbottom', pbOptions);
    
    
  </script>

  

  
  
  
  <script src="/lib/pangu/dist/pangu.min.js?v=3.3"></script>
  <script type="text/javascript">pangu.spacingPage();</script>


  

  

  

  
  <style>
    .copy-btn {
      display: inline-block;
      padding: 6px 12px;
      font-size: 13px;
      font-weight: 700;
      line-height: 20px;
      color: #333;
      white-space: nowrap;
      vertical-align: middle;
      cursor: pointer;
      background-color: #eee;
      background-image: linear-gradient(#fcfcfc, #eee);
      border: 1px solid #d5d5d5;
      border-radius: 3px;
      user-select: none;
      outline: 0;
    }

    .highlight-wrap .copy-btn {
      transition: opacity .3s ease-in-out;
      opacity: 0;
      padding: 2px 6px;
      position: absolute;
      right: 4px;
      top: 8px;
    }

    .highlight-wrap:hover .copy-btn,
    .highlight-wrap .copy-btn:focus {
      opacity: 1
    }

    .highlight-wrap {
      position: relative;
    }
  </style>
  <script>
    $('.highlight').each(function (i, e) {
      var $wrap = $('<div>').addClass('highlight-wrap')
      $(e).after($wrap)
      $wrap.append($('<button>').addClass('copy-btn').append('复制').on('click', function (e) {
        var code = $(this).parent().find('.code').find('.line').map(function (i, e) {
          return $(e).text()
        }).toArray().join('\n')
        var ta = document.createElement('textarea')
        document.body.appendChild(ta)
        ta.style.position = 'absolute'
        ta.style.top = '0px'
        ta.style.left = '0px'
        ta.value = code
        ta.select()
        ta.focus()
        var result = document.execCommand('copy')
        document.body.removeChild(ta)
        
          if(result)$(this).text('复制成功')
          else $(this).text('复制失败')
        
        $(this).blur()
      })).on('mouseleave', function (e) {
        var $b = $(this).find('.copy-btn')
        setTimeout(function () {
          $b.text('复制')
        }, 300)
      }).append(e)
    })
  </script>


  


  <!-- 点击出现桃心效果 -->
  <script type="text/javascript" src="/js/src/clickedLove.js"></script>

  <!-- Aplayer -->
  <link rel="stylesheet" href="/aplayer/APlayer.min.css">
  <div id="aplayer"></div>
  <script type="text/javascript" src="/aplayer/APlayer.min.js"></script>
  <script type="text/javascript" src="/aplayer/music.js"></script>

</body>
</html>
